package com.weishu.housing.controller;


import com.weishu.common.core.web.domain.AjaxResult;
import com.weishu.core.entity.*;
import com.weishu.core.service.*;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 集中式房源 添加
 */
@RestController
@RequestMapping("fensan")
public class DecentralRoomController {

    @Autowired
    private ITbFensanHouseService iTbFensanHouseService;
    @Autowired
    private ITbPremisesInfoService iTbPremisesInfoService;
    /**
     * 独立配置持久层
     */
    @Autowired
    private ITbPrivateFacilityService iTbPremisesFacilityService;
    /**
     * 公共配置持久层
     */
    @Autowired
    private ITbPublicFacilityService iTbPublicFacilityService;


    /**
     * 独立配置表
     * @return
     */
    @RequestMapping("prifacilitylist")
    public AjaxResult PrivateFacilityList(){
        List<TbPrivateFacility> list = iTbPremisesFacilityService.list();
        return AjaxResult.success(list);
    }
    /**
     * 公共配置表
     * @return
     */
    @RequestMapping("pubfacilitylist")
    public AjaxResult PublicFacility(){
        List<TbPublicFacility> list = iTbPublicFacilityService.list();
        return AjaxResult.success(list);
    }
    /**
     * 查询楼盘
     * @return
     */
    @RequestMapping("loulist")
    public AjaxResult Publoupan(){
        List<TbPremisesInfo> list = iTbPremisesInfoService.querylistloupan();
        return AjaxResult.success(list);
    }



    /**
     * 添加
     * @param
     * @return
     */
    @RequestMapping("savefensan")
    public AjaxResult saveHouseStyle(TbFensanHouse tbFensanHouse){
        String s1 = tbFensanHouse.getS1();
        tbFensanHouse.setPubs(s1);
        String s2 = tbFensanHouse.getS2();
        tbFensanHouse.setPrivateFacli(s2);
        tbFensanHouse.setIntos(0);
        boolean save = iTbFensanHouseService.save(tbFensanHouse);
        return AjaxResult.success(save);
    }

    @RequestMapping("savejizhong")
    public AjaxResult saveHouseJi(TbFensanHouse tbFensanHouse){
        String s1 = tbFensanHouse.getS1();
        tbFensanHouse.setPubs(s1);
        tbFensanHouse.setIntos(1);
        boolean save = iTbFensanHouseService.save(tbFensanHouse);
        return AjaxResult.success(save);
    }



}
